<?php

use yii\helpers\Html;
use common\components\GridView;

use common\components\Common;
use common\modules\admin\models\Admin;
/* @var $this yii\web\View */
/* @var $searchModel oss\models\search\AdminSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '管理员';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="admin-index">

    <h1><?= Html::encode($this->title) ?></h1>

    <p>
        <?= Html::a('创建管理员', ['create'], ['class' => 'btn btn-success']) ?>
    </p>
    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            'admin_id',
            'name',
            'nick',
            ['attribute'=>'phone','value'=>function ($model, $key, $index, $column){if($model['phone']){ $model['phone'] = Common::maskNumber($model['phone']);return $model['phone'];}}],
            ['attribute'=>'deleted','value'=>function ($model, $key, $index, $column){return Admin::$dropdownFields['deleted'][$model['deleted']];},'filter'=>Admin::$dropdownFields['deleted']],
            '_intm',
            '_uptm',

            ['class' => 'yii\grid\ActionColumn'],
        ],
    ]); ?>

</div>
